<template>
  <div>
    <van-tabbar
      v-model="localActiveIndex"
      active-color="#0077FF"
      @change="onChange"
    >
      <van-tabbar-item>
        <span>首页</span>
        <template #icon="props">
          <img :src="props.active ? active : inactive" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item>
        <span>我的提交</span>
        <template #icon="props">
          <img :src="props.active ? active2 : inactive2" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item>
        <span>我的待办</span>
        <template #icon="props">
          <img :src="props.active ? active3 : inactive3" />
        </template>
      </van-tabbar-item>
      <van-tabbar-item>
        <span>个人中心</span>
        <template #icon="props">
          <img :src="props.active ? active4 : inactive4" />
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import inactive from '@/assets/common/组 5859.png'
import active from '@/assets/common/组 5870.png'
import inactive2 from '@/assets/common/组 5869.png'
import active2 from '@/assets/common/组 5866.png'
import inactive3 from '@/assets/common/组 5856.png'
import active3 from '@/assets/common/组 5867.png'
import inactive4 from '@/assets/common/组 5858.png'
import active4 from '@/assets/common/组 5868.png'
export default {
  name: 'tabbarIndex',
  props: {
    activeIndex: {
      type: Number,
      default: 0,
    },
  },
  components: {},
  data() {
    return {
      active,
      inactive,
      active2,
      inactive2,
      active3,
      inactive3,
      active4,
      inactive4,
      localActiveIndex: this.activeIndex,
    }
  },
  methods: {
    onChange(index) {
      if (index == 0) {
        this.$router.push('/index')
      } else if (index == 1) {
        this.$router.push({
          name:'MySubmitIndex'
        })
      } else if (index == 2) {
        this.$router.push('/myToDoList')
      } else if (index == 3) {
        this.$router.push('/mine')
      }
    },
  },
  mounted() {},
  watch: {},
  computed: {},
  filters: {},
}
</script>

<style scoped lang="scss"></style>
